<?php
	session_start();
	include('../functions/soap.php');
	include('../subpages/head.php');
	
	// -- Initiate testing -- //
	echo('<h1>Testcase: [baseclass]Student</h1>');
	
	//Create Student
	$testStudent = new Student($wsdl);
	
	//Fill array with testdata
	$setstudent = array();
	$setstudent[] = '1501501'; //student_nr
	$setstudent[] = 'Harry'; //voornaam
	$setstudent[] = 'Groot'; //achternaam
	$setstudent[] = 'de'; //tussenvoegsel
	$setstudent[] = 'Informatica'; //opleiding
	$setstudent[] = 'Actief'; //actief
	$setstudent[] = NULL; //stages
		
	//Set data with set-methods
	$testStudent->setId(NULL);
	$testStudent->setStudent_nr($setstudent[0]);
	$testStudent->setVoornaam($setstudent[1]);
	$testStudent->setAchternaam($setstudent[2]);
	$testStudent->setTussenvoegsel($setstudent[3]);
	$testStudent->setOpleiding($setstudent[4]);
	$testStudent->setActief($setstudent[5]);
	$testStudent->setStages($setstudent[6]);
	
	//print array
	echo('<strong>Ingevoerde waarden in SETTERS: </strong>');
	echo('<pre>');
	print_r($setstudent);
	echo('</pre>');
	
	//Save object to database
	$new_id = $testStudent->save();
	echo('<strong>save() methode aangeroepen...</strong><br />');
	echo('Return value: '.$new_id.'<br /><br />');
	
	//Get saved bedrijf object from database
	$testGetStudent = new GetStudent($wsdl);
	$studentObj = $testGetStudent->GetStudent($new_id);
	
	//Get Object data with get-methods
	$getstudentobj = array();
	$getstudentobj[] = $studentObj->getStudent_nr();
	$getstudentobj[] = $studentObj->getVoornaam();
	$getstudentobj[] = $studentObj->getAchternaam();
	$getstudentobj[] = $studentObj->getTussenvoegsel();
	$getstudentobj[] = $studentObj->getOpleiding();
	$getstudentobj[] = $studentObj->getActief();
	$getstudentobj[] = $studentObj->getStages();
	
	//Print array
	echo('<strong>Waarden gehaald uit gesavede object: </strong>');
	echo('<pre>');
	print_r($getstudentobj);
	echo('</pre>');
	
	//Compare arrays
	echo('<strong>Vergelijk input met output...</strong><br />');
	$c = count($getstudentobj);
	for($i = 0; $i < $c; $i++){
		if($getstudentobj[$i] != $setstudent[$i]){
			echo('<span style="color:red; font-weight:bold;">Fout! Uitvoer &raquo;<i>'.$getstudentobj[$i].'</i>&laquo; 
					komt niet overeen met invoer &raquo;<i>'.$setstudent[$i].'</i>&laquo;</span><br />');
		}
		else{
			echo('<span style="color:green;">Goed!</span> Uitvoer &raquo;<i>'.$getstudentobj[$i].'</i>&laquo; 
					komt overeen met invoer &raquo;<i>'.$setstudent[$i].'</i>&laquo;<br />');
		}
	}
	
?>